package com.liuqi.loggers.core;

import com.liuqi.loggers.core.encode.PatternEncoder;

/**
 * @author liuqi
 * @date 2024/10/14 15:47
 **/
public class Constants {

    /**
     * 日志格式化
     */
    public static String PATTERN = "%date %level [%thread] %class : %message %throwable";

    /**
     * 编码
     */
    public static String CHARSET = "UTF-8";

    /**
     * Dot 符号
     */
    public static final String DOT = ".";

    /**
     * * 符号
     */
    public static final String ASTERISK = "*";

    /**
     * $ 符号
     */
    public static final String DOLLAR = "$";

    /**
     * 默认的日志编码器
     */
    public static Encoder defaultEncoder;

    /**
     * @return  获取默认的编码器
     */
    public static synchronized Encoder defaultEncoder() {
        if (defaultEncoder == null) {
            PatternEncoder encoder = new PatternEncoder();
            encoder.setPattern(PATTERN);
            encoder.setCharset(CHARSET);
            defaultEncoder = encoder;
        }
        return defaultEncoder;
    }

}
